/**
 * auth: zhukaijun
 * date: 2021-8-13
 * des: use graphql example
 */
import { useQuery, useResult } from "@vue/apollo-composable";
import { reactive, toRefs } from 'vue';
import gql from 'graphql-tag';

export const root = () => {
    // const state = reactive({ type: undefined, name: undefined });
    // const setParams = params => {
    //     setPagingParams(params);
    //     if (params.type || params.name) Object.entries(params).forEach(([key, value]) => (state[key] = value));
    // };
    const { result } = useQuery(
        gql`
            query user($userInput:UserInput!) {
                user(userInput:$userInput){
                    id
                    age
                    rate
                    name
                }
            }
        `, { userInput: { id: 7018506732552847360 } });
    const root = useResult(result, null, (data) => data.user);
    return { root };
}
